

<%@ page import="sushidiscount.Discount" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="sushiheader" />
        <g:set var="entityName" value="${message(code: 'discount.label', default: 'Discount')}" />
        <title><g:message code="default.create.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="list" action="list">Lista de Descuentos</g:link></span>
        </div>
        <div class="body">
            <h1>Agregar un nuevo descuento</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${discountInstance}">
            <div class="errors">
                <g:renderErrors bean="${discountInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="sushiplace">Local</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'sushiplace', 'errors')}">
                                    <g:select name="sushiplace.id" from="${sushidiscount.SushiPlace.list()}" optionKey="id" value="${discountInstance?.sushiplace?.id}"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="percentage">Porcentaje</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'percentage', 'errors')}">
                                    <g:select name="percentage" from="${discountInstance.constraints.percentage.inList}" value="${fieldValue(bean: discountInstance, field: 'percentage')}" valueMessagePrefix="discount.percentage"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="payform">Forma de Pago</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'payform', 'errors')}">
                                    <g:select name="payform" from="${discountInstance.constraints.payform.inList}" value="${discountInstance?.payform}" valueMessagePrefix="discount.payform"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="membership">Club Socio</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'membership', 'errors')}">
                                    <g:select name="membership" from="${discountInstance.constraints.membership.inList}" value="${discountInstance?.membership}" valueMessagePrefix="discount.membership"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="aplicable">Aplicable sobre</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'aplicable', 'errors')}">
                                    <g:select name="aplicable" from="${discountInstance.constraints.aplicable.inList}" value="${discountInstance?.aplicable}" valueMessagePrefix="discount.aplicable"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="delivery">Despacho</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'delivery', 'errors')}">
                                    <g:select name="delivery" from="${discountInstance.constraints.delivery.inList}" value="${discountInstance?.delivery}" valueMessagePrefix="discount.delivery"  />
                                </td>
                            </tr>
                                    
                        </tbody>
                    </table>
                  <br/>
                  <table>
                    <tbody>

                        <tr>
                          <td>
                          <table>
                              <tr>
                                  <td valign="top" class="name">
                                      <label for="monday">Lunes</label>
                                  </td>
                                  <td valign="top" class="name">
                                      <label for="tuesday">Martes</label>
                                  </td>
                                  <td valign="top" class="name">
                                      <label for="wednesday">Miércoles</label>
                                  </td>
                                  <td valign="top" class="name">
                                      <label for="thursday">Jueves</label>
                                  </td>
                                  <td valign="top" class="name">
                                      <label for="friday">Viernes</label>
                                  </td>
                                  <td valign="top" class="name">
                                      <label for="saturday">Sábado</label>
                                  </td>
                                  <td valign="top" class="name">
                                      <label for="sunday">Domingo</label>
                                  </td>
                              </tr>
                              <tr>

                                  <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'monday', 'errors')}">
                                      <g:checkBox name="monday" value="${discountInstance?.monday}" />
                                  </td>

                                  <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'tuesday', 'errors')}">
                                      <g:checkBox name="tuesday" value="${discountInstance?.tuesday}" />
                                  </td>

                                  <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'wednesday', 'errors')}">
                                      <g:checkBox name="wednesday" value="${discountInstance?.wednesday}" />
                                  </td>

                                  <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'thursday', 'errors')}">
                                      <g:checkBox name="thursday" value="${discountInstance?.thursday}" />
                                  </td>

                                  <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'friday', 'errors')}">
                                      <g:checkBox name="friday" value="${discountInstance?.friday}" />
                                  </td>

                                  <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'saturday', 'errors')}">
                                      <g:checkBox name="saturday" value="${discountInstance?.saturday}" />
                                  </td>

                                  <td valign="top" class="value ${hasErrors(bean: discountInstance, field: 'sunday', 'errors')}">
                                      <g:checkBox name="sunday" value="${discountInstance?.sunday}" />
                                  </td>
                              </tr>
                          </table>
                          </td>
                      </tr>
                    </tbody>
                  </table>

                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="Agregar Descuento" /></span>
                </div>
            </g:form>
        </div>

        <g:render template="/footer" />

    </body>
</html>
